#ifndef _MK_LOGGER_H__
#define _MK_LOGGER_H__
/*
#define DBG_LOGMSG(szMessage, ...)
#define DBG_LOGBUFFER(pBuffer, nBufLen, szMessage, ...)
#define DBG_SETLOGFILE(szLogFile)
*/


#ifdef ANDROID
	#include <android/log.h>

	#define  LOG_TAG    "MK_LOG"

	#ifdef _DEBUG
		void android_log_buffer(unsigned char * pBuffer, long nBufLen , const char * szMessage, ...);
		void android_log_msg(const char * szMessage, ...);

		#define  LOGI(...)  		__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
		#define  DBG_LOGMSG(szMessage, ...)			 android_log_msg(szMessage, ##__VA_ARGS__) //LOGI
		#define  DBG_LOGBUFFER		android_log_buffer

	#else
		#define  LOGI(...)
		#define  DBG_LOGMSG			LOGI
		#define  DBG_LOGBUFFER
	#endif
#else
	#ifdef _DEBUG
				#define DBG_SETLOGFILE(szLogFile)							mk_logger::set_logfile(szLogFile)
				#define DBG_LOGMSG(szMessage, ...)							mk_logger::log_message(szMessage, ##__VA_ARGS__)
				#define DBG_LOGBUFFER(pBuffer, nBufLen, szMessage, ...)		mk_logger::log_buffer(pBuffer, nBufLen, szMessage,##__VA_ARGS__)
				#define DBG_REMOVELOGFILE									mk_logger::remove_logfile()
	#else
				#define DBG_LOGMSG(szMessage, ...)
				#define DBG_LOGBUFFER(pBuffer, nBufLen, szMessage, ...)
				#define DBG_SETLOGFILE(szLogFile)
				#define DBG_REMOVELOGFILE()	
	#endif
#endif

class mk_logger
{

public:
	mk_logger();
	virtual ~mk_logger();

	
public:

	static void set_logfile(const char * logfile);
	static void log_message(const char * szMessage, ...);
	static void log_buffer(unsigned char * pBuffer, long nBufLen , const char * szMessage, ...);

	static void remove_logfile();

#ifdef WIN32
	static void log_message2(const char * szMessage, ...);
#endif

private:
	static int get_log_time(char *s);

	static void init_log_path();
private:
	static char m_szLogFileName[260];
};

#endif // LOG_H
